﻿using System.Web.Mvc;
using Omu.Awesome.Mvc.Helpers;

namespace Omu.Awesome.Mvc
{
    public class AutocompleteAttribute : MetadataAttribute
    {
        public string Controller { get; set; }
        public int MaxResults { get; set; }
        public string ParentId { get; set; }
        public string PropId { get; set; }
        public int MinLength { get; set; }
        public int Delay { get; set; }

        public override void Process(ModelMetadata m)
        {
            m.Add(Controller != null, "controller", Controller);
            m.Add(MaxResults != 0, "maxResults", MaxResults);
            m.Add(ParentId != null, "parentId", ParentId);
            m.Add(PropId != null, "propId", PropId);
            m.Add(MinLength != 0, "minLength", MinLength);
            m.Add(Delay != 0, "delay", Delay);
        }
    }
}